import request from '@/utils/request'


function getMaList(params) {
  return request({
    url: `/league/competition/webList`,
    method: 'get',
    params: params
  })
}

function getMatchById(params) {
  return request({
    url: `/league/competition/detail`,
    method: 'get',
    params: params
  })
}

function getMySignCptList(query) {
  return request({
    url: `/league/competition/getMySignCptList`,
    method: 'get',
    params: query
  })
}

function getMySignDetailById(params) {
  return request({
    url: `/league/sign/getMySignPage`,
    method: 'get',
    params: params
  })
}

// 获取赛事下的已报团队
function getGroupListByCptId(cptId) {
  return request({
    url: `/league/group/getGroupListByCptId/${cptId}`,
    method: 'get'
  })
}

function getMyPersonInfoWithcptId(cptId) {
  return request({
    url: `/systemj/personInfo/getMyPersonInfo/${cptId}`,
    method: 'get'
  })
}

function getMyPersonInfo() {
  return request({
    url: `/systemj/personInfo/getMyPersonInfo`,
    method: 'get'
  })
}

function countryList() {
  return request({
    url: `/systemj/country/countryList`,
    method: 'get'
  })
}

function saveMyBaseInfo(data) {
  return request({
    url: `/systemj/personInfo/saveMyBaseInfo`,
    method: 'post',
    data: data
  })
}

// 发送手机验证码
function getCaptchaSms(data) {
  return request({
    url: `/captchaSmsByCheckCode`,
    method: 'post',
    data: data
  })
}

function getMyGroupList() {
  return request({
    url: `/league/group/getMyGroupList`,
    method: 'get'
  })
}

// 根据Id获取我的团队
function getGroupById(groupId) {
  return request({
    url: `/league/group/getMyGroup/${groupId}`,
    method: 'get'
  })
}

function regionsList() {
  return request({
    url: `/systemj/region/regionsList`,
    method: 'get'
  })
}

// 新建团队
function saveMyGroup(data) {
  return request({
    url: `/league/group/saveMyGroup`,
    method: 'post',
    data: data
  })
}

// 退出团队
function leaveGroup(groupId) {
  return request({
    url: `/systemj/personInfo/leaveGroup/${groupId}`,
    method: 'post'
  })
}

// function projectConfigList(params) {
//   return request({
//     url: '/systemj/projectConfig/list',
//     method: 'get',
//     params: params
//   })
// }
function projectConfigList(params) {
  return request({
    url: '/systemj/baseProject/list',
    method: 'get',
    params: params
  })
}

// 根据Id获取人员信息
function getPersonInfoById(id) {
  return request({
    url: `/systemj/personInfo/${id}`,
    method: 'get'
  })
}

// 保存补充信息
function saveSupplementInfo(data) {
  return request({
    url: `/league/competitionPersonInfo/savePersonInfo`,
    method: 'post',
    data: data
  })
}

// 获取补充信息
function getSupplementInfo(id) {
  return request({
    url: `/league/competitionPersonInfo/${id}`,
    method: 'get'
  })
}

function getMySignInfo(data) {
  return request({
    url: `/league/sign/getMySignInfo`,
    method: 'post',
    data: data
  })
}

function getGroupListByProjectId(cptProjectId) {
  return request({
    url: `/league/competitionGroup/getGroupListByProjectId/${cptProjectId}`,
    method: 'get'
  })
}

function getLeveListByGroupId(cptGroupId) {
  return request({
    url: `/league/competitionLevel/getLeveListByGroupId/${cptGroupId}`,
    method: 'get'
  })
}

function saveMyTeam(data) {
  return request({
    url: `/league/team/saveMyTeam`,
    method: 'post',
    data: data
  })
}

function getMyOrderList(params) {
  return request({
    url: `/league/signOrder/getMyOrderList`,
    method: 'get',
    params: params
  })
}

function getMySignListFromOrderList(orderId) {
  return request({
    url: `/league/sign/getMySignListFromOrderList/${orderId}`,
    method: 'get'
  })
}

function getMyOrderDetail(orderId) {
  return request({
    url: `/league/signOrder/getMyOrderDetail/${orderId}`,
    method: 'get'
  })
}

function getVenueList(query) {
  return request({
    url: `/systemj/venue/queryPageListForWeb`,
    method: 'get',
    params: query
  })
}

function getVenueDetail(id) {
  return request({
    url: `/systemj/venue/detailForWeb/${id}`,
    method: 'get'
  })
}

// 获取团队下的队伍
function getMyTeamList(cptId, groupId) {
  return request({
    url: `/league/team/getTeamList/${cptId}/${groupId}`,
    method: 'get'
  })
}

function getMyGroupForCpt(groupId, cptId) {
  return request({
    url: `/league/group/getMyGroupForCpt/${groupId}/${cptId}`,
    method: 'get'
  })
}

function getMyGroupForCptFilter(groupId, cptId, query) {
  return request({
    url: `/league/group/getMyGroupForCptFilter/${groupId}/${cptId}`,
    method: 'post',
    data: query
  })
}

// 获取团队报名时已选人员
function getChooseDoneGroupCoachs(cptId, groupId) {
  return request({
    url: `/league/unitCompetitionRole/getGroupInfo/${cptId}/${groupId}`,
    method: 'get'
  })
}

// 获取个人报名时已选人员
function getChooseDoneSingleCoachs(cptId) {
  return request({
    url: `/league/unitCompetitionRole/getPersonInfo/${cptId}`,
    method: 'get'
  })
}

function savePersonForMyGroup(data) {
  return request({
    url: `/systemj/personInfo/savePersonForMyGroup`,
    method: 'post',
    data: data
  })
}

function savePersonForMyPerson(data) {
  return request({
    url: `/systemj/personInfo/savePersonForMyPerson`,
    method: 'post',
    data: data
  })
}

// 人员修改
function editPersonInfo(params) {
  return request({
    url: `/systemj/personInfo`,
    method: 'put',
    data: params
  })
}

// 人员删除
function delPerson(id) {
  return request({
    url: `/systemj/personInfo/${id}`,
    method: 'delete'
  })
}

function singleSignSavePerson(data) {
  return request({
    url: `/league/unitCompetitionRole/savePersonInfo`,
    method: 'post',
    data: data
  })
}

function groupSignSavePerson(data) {
  return request({
    url: `/league/unitCompetitionRole/saveGroupInfo`,
    method: 'post',
    data: data
  })
}

function getCanSignProjectList(cptId) {
  return request({
    url: `/league/competitionProject/getCanSignProjectListFromSelectPerson/${cptId}`,
    method: 'get'
  })
}

function getCanSignGroupListFromSelectPerson(projectId, personId) {
  return request({
    url: `/league/competitionGroup/getCanSignGroupListFromSelectPerson/${projectId}/${personId}`,
    method: 'get'
  })
}

function getCanSignlevelListFromSelectPerson(groupId, personId) {
  return request({
    url: `/league/competitionLevel/getCanSignLevelListFromSelectPerson/${groupId}/${personId}`,
    method: 'get'
  })
}
function delRank(id) {
  return request({
    url: `/league/team/${id}`,
    method: 'delete'
  })
}
function getCanSignLevelPerson(data) {
  return request({
    url: `/league/competitionLevel/getCanSignLevelPerson`,
    method: 'post',
    data: data
  })
}
function sportsmanDone(data) {
  return request({
    url: `/league/sign/signUp`,
    method: 'post',
    data: data
  })
}
// 删除报名接口
function deleteSign(id) {
  return request({
    url: `/league/sign/deleteSign/${id}`,
    method: 'post'
  })
}
// 选择运动员的补充信息表头
function getCptExtraInfo(cptId) {
  return request({
    url: `/league/competition/getCptExtraInfo/${cptId}`,
    method: 'get'
  })
}
function recoverMySign(data) {
  return request({
    url: `/league/sign/recoverMySign`,
    method: 'post',
    data: data
  })
}
// 生成订单
function commitSign(data) {
  return request({
    url: `/league/sign/commitSign`,
    method: 'post',
    data: data
  })
}
function getTotalFee(data) {
  return request({
    url: `/league/expenseConfig/getTotalFee`,
    method: 'post',
    data: data
  })
}
function getMemberInfoByCptId(cptId) {
  return request({
    url: `/systemj/member/editMemberCode/${cptId}`,
    method: 'get'
  })
}
function getTemplate() {
  return request({
    url: `/systemj/personInfo/getTemplate`,
    method: 'get'
  })
}
// 支付 orderId,payType
function payMatch(data) {
  return request({
    url: `/league/signOrder/payForOrderFromPc`,
    method: 'post',
    data: data
  })
}
function cancelMyUnPayedOrder(orderId) {
  return request({
    url: `/league/signOrder/cancelMyUnPayedOrder/${orderId}`,
    method: 'post'
  })
}
function getMySignListFromBaoXiang(data) {
  return request({
    url: `/league/sign/getMySignListFromBaoXiang`,
    method: 'post',
    data: data
  })
}
function deleteMyGroup(groupId) {
  return request({
    url: `/league/group/deleteMyGroup/${groupId}`,
    method: 'post'
  })
}
function checkPerson(data) {
  return request({
    url: `/systemj/personInfo/checkPersonInfoExist`,
    method: 'post',
    data: data
  })
}
function getMySignListTree(cptId, personId, teamId) {
  return request({
    url: `/league/competitionProject/getAllInfoFromSelectPerson/${cptId}/${personId}/${teamId || 0}`,
    method: 'get'
  })
}
function getMySignInfoList(data) {
  return request({
    url: `/league/sign/getMySignInfoList`,
    method: 'post',
    data: data
  })
}
function saveMyGroupExtraInfo(data) {
  return request({
    url: `/league/competitionGroupInfo/saveMyGroupExtraInfo`,
    method: 'post',
    data: data
  })
}
function getMySignIds(cptId, personId, teamId) {
  return request({
    url: `/league/sign/getSignEntityByPersonId/${cptId}/${personId}/${teamId || 0}`,
    method: 'get'
  })
}
function querySonLevel(parentId) {
  return request({
    url: `/league/competitionSonLevel/querySonLevelByParentId/${parentId}`,
    method: 'get'
  })
}
function getPayedOrderPdf(cptId,groupId) {
  return request({
    url: `/pdf/getPayedOrderPdf/${cptId}/${groupId}`,
    method: 'get'
  })
}

export {
  getMaList, getMatchById, getGroupListByCptId, getMyPersonInfo, getMyPersonInfoWithcptId,
  countryList, saveMyBaseInfo, getCaptchaSms, getMyGroupList, getGroupById, regionsList,
  saveMyGroup, leaveGroup, projectConfigList,
  getPersonInfoById, saveSupplementInfo, getSupplementInfo, getMySignInfo, getGroupListByProjectId,
  getLeveListByGroupId, saveMyTeam,
  getMySignCptList, getMySignDetailById, getMyOrderList, getMySignListFromOrderList, getMyOrderDetail,
  getVenueList, getVenueDetail, getMyTeamList,
  getMyGroupForCpt, getChooseDoneGroupCoachs, getChooseDoneSingleCoachs, savePersonForMyGroup, savePersonForMyPerson,
  editPersonInfo, delPerson, singleSignSavePerson, groupSignSavePerson,
  getCanSignProjectList, getCanSignGroupListFromSelectPerson, getCanSignlevelListFromSelectPerson,
  delRank, getCanSignLevelPerson, sportsmanDone, deleteSign, getCptExtraInfo,
  recoverMySign, commitSign, getTotalFee, getMemberInfoByCptId, payMatch, cancelMyUnPayedOrder,
  getMySignListFromBaoXiang, deleteMyGroup, checkPerson, getTemplate,

  getMySignListTree, getMySignInfoList, getMySignIds, querySonLevel,
  getMyGroupForCptFilter,saveMyGroupExtraInfo,getPayedOrderPdf
}

